<template>
  <!--
  组件的v-model
    <子组件标签  :value="父组件属性" @input="父组件属性=$event" />

    <子组件标签  v-model="父组件属性"  />
    子组件内:
       props:{
        value:{type:Number}
       },
       model:{
          prop:'value',
          event:'input'
       },
       this.$emit('input',实参值)
 -->

  <div>
    <h2>父组件 :{{ num }}</h2>

    <hr />
    <!-- <HmNum :value="num" @input="num = $event"></HmNum> -->
    <HmNum v-model="num"></HmNum>
    <!-- <HmNum :value="num" @input="setNum($event)"></HmNum> -->
    <!-- <button @click="btnClick2($event)">111</button> -->
  </div>
</template>
<script>
import HmNum from './components/HmNum.vue'
export default {
  components: {
    HmNum
  },
  data () {
    return {
      num: 0
    }
  },
  methods: {
    setNum (xxx) {
      this.num = xxx
    },
    btnClick2 (e) {
      console.log(e)
    }
  }
}
</script>
<style></style>
